#include <Wt/WTimer>
#include "TimerPageBase.h"

using namespace Wt;

TimerPageBase::TimerPageBase(int interval, WObject *parent)
	: m_interval(interval)
{
	m_timer = new Wt::WTimer(parent);
	m_timer->setInterval(m_interval);
	m_timer->timeout.connect(SLOT(this, TimerPageBase::refresh0));
}

int TimerPageBase::getInterval()
{
	return m_interval;
}

void TimerPageBase::setInterval(int interval)
{
	if(interval < 1000)
	{
		m_interval = 1000;
	}
	else
	{
		m_interval = interval;
	}
}
	
void TimerPageBase::start()
{
	refresh();
	m_timer->start();
}

void TimerPageBase::stop()
{
	m_timer->stop();
}
	
void TimerPageBase::refresh0()
{
	refresh();
}

